#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;

int lengthOfLongestSubstring(string s) {
	unordered_map<char,int> mp;
	int max = 0;
	for(int i=0; i<s.length(); i++){
		cout << s[i];
		auto it = mp.find(s[i]);
		if( it!=mp.end() ){
			if( mp.size()> max ) max = mp.size();
			for(auto i=mp.begin(); i!=mp.end();){
				if( (*i).second<=(*it).second ) mp.erase(i++);
				else ++i;
			}
		}else mp[s[i]] = i;
	}
	return max;
}
int main(){
	string s = "wsbweee";
	cout << lengthOfLongestSubstring(s);
	return 0;
} 
